﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GcmpDrawingText.h"
#include <vector>
#include <GbmpTypeDefs.h>
#include <OwnerPtr.h>
#include "RichTextAlignmentType.h"
#include "IDrawingAnnotationText.h"

#define BASE_CHAR_HEIGHT 3.5 // 参照GB/T14691-1993标准，汉字高度不低于3.5mm

namespace gcmp
{
    class Vector2d;
    class Vector3d;
    struct Color;

    /// \brief 文字编辑框输入完成处理
    class GCMP_DRAWING_TEXT_EXPORT IDrawingTextEditorHandler
    {
    public:
        virtual ~IDrawingTextEditorHandler();
        /// \brief 文字编辑框输入完成回调
        /// \param content 编辑框内容(格式化)字符串
        /// \return
        virtual  void OnTextEditFinish(const std::wstring& acadStyleString) = 0;

        /// \brief 文字编辑框输入取消回调
        /// \param 
        /// \return 
        virtual  void OnTextEditCancel() = 0;
    };

    /// \brief 图纸文字编辑框
    class GCMP_DRAWING_TEXT_EXPORT IDrawingTextEditWidget
    {
    public:
        /// \brief 析构函数
        virtual ~IDrawingTextEditWidget();


        /// \brief 图纸文字编辑框控件。
        ///
        /// 初始黑色背景。
        ///
        /// \param pDocument 文档指针
        /// \return std::vector<UniIdentity> 返回可拾取过滤的类别
        static OwnerPtr<IDrawingTextEditWidget> Create(UInt64  parentWidgetId, IDrawingAnnotationText* pText, int ctrlx, int ctrly, int ctrlWidth, int ctrlHeight, double viewScale);
        //virtual void CreateEditBarDialog() = 0;

        virtual bool ReSize(int ctrlx, int ctrly, int ctrlWidth, int ctrlHeight) = 0;

        /// \brief 设置编辑结束回调处理器
        ///
        /// \param pDocument 文档指针
        /// \return 成功返回true，否则false
        virtual bool SetTextEditorHandler(OwnerPtr<IDrawingTextEditorHandler> opEditorHandler) = 0;

        virtual void FinishEdit() = 0;

        // ?????
        virtual void CancelEdit() = 0;
    };

}

